﻿@model SelfMadeMillionaire.Web.Infrastructure.ViewModels.MailingList.AdminChangePasswordViewModel


<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td>
			<div class="form-group">
				@Html.LabelFor(m => m.Password, new { @class = "col-sm-3 control-label custom_label" })
				<div class="col-sm-7">
				    @Html.PasswordFor(m => m.Password, new { @class = "form-control", placeholder = "Enter New password" })
					@Html.ValidationMessageFor(m=>m.Password)
				</div>
			</div>
		</td>
	</tr>
	<tr>
		<td>
			<div class="form-group">
			    @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-sm-3 control-label custom_label" })
				<div class="col-sm-7">
				    @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control", placeholder = "Enter Confirm password" })
					@Html.ValidationMessageFor(m=>m.ConfirmPassword)
				</div>
			</div>
		</td>
	</tr>
	

</table>

<script type="text/javascript">
	$(function () {

		$("input[type='submit']").click(function (e) {
			e.preventDefault();

			var form = $(this).closest("form");

			if ($(form).valid()) {
				$.ajax({
					url: $(form).attr("action"),
					type: "POST",
					data: form.serialize(),
					cache: false,
					success: function (result) {
					    if (result.success) {
					        $("#edit-modal-container").modal('hide');
					        ShowModalMessage('Password Changed Successfully!');
					    }
					    else
					        $("#edit-modal-container").html(result);
					}
				});
			}
		});

	});
</script>
